using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Lavanderia.Entities;

namespace Lavanderia.Repository.Mapping
{
    public class CLIENTEMap : EntityTypeConfiguration<CLIENTE>
    {
        public CLIENTEMap()
        {
            // Primary Key
            this.HasKey(t => t.CodCli);

            // Properties
            this.Property(t=>t.CodCli)
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Direccion)
                .IsOptional()
                .HasMaxLength(200);

            this.Property(t => t.Email)
                .IsOptional()
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("CLIENTE");
            this.Property(t => t.CodCli).HasColumnName("CodCli");
            this.Property(t => t.Direccion).HasColumnName("Direccion");
            this.Property(t => t.Email).HasColumnName("Email");
        }
    }
}
